<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
</head>
<body>
    <p id='sourceTxt'>这是将要复制的文本</p>
    <textarea id="copyTxt" cols="30" rows="10"></textarea>
    <button id='btn'>点击复制</button>
    <script>
    btn.onclick = function () {
        copyTxt.value = sourceTxt.innerText		
        copyTxt.select()						
      
    }
 </script>
</body>
<script type="text/javascript">
    let a=true
    function show() {
        var div= document.getElementById('div')
        if (a) {
        a=!a
        var newH2=document.createElement('h2')
        var text =document.createTextNode('封校三天 快乐无边')
        newH2.appendChild(text)
        div.appendChild(newH2);
        }
        
        var newButtom=document.getElementById('button')
        if (newButtom.value==='展开') {
            div.style.display=''
            newButtom.value='收起'
        }else{
            div.style.display='none'
            newButtom.value='展开'
        }          
    }
</script>
<input type="button" value="展开" onclick="show()"id="button" >
<div id="div"style="display: none"></div>
</body>
</html>
